double min_alt;
double max_spd; /* Meters/sec */
double min_spd; /* Meters/sec */
+ double avg_hrt; /* Avg Heartrate */
+ double avg_cad; /* Avg Cadence */
time_t start; /* Min time */
time_t end; /* Max time */
+ int min_hrt; /* Min Heartrate */
+ int max_hrt; /* Max Heartrate */
+ int max_cad; /* Max Cadence */
} computed_trkdata;
/*
double spd = fmt_speed(td->max_spd, &spd_units);
TD2("<b>Max Speed</b> %.1f %s", spd, spd_units);
}
+ if (td->avg_hrt) {
+ TD("<b>Avg Heart Rate</b> %.1f bpm", td->avg_hrt);
+ }
+ if (td->min_hrt < td->max_hrt) {
+ TD("<b>Min Heart Rate</b> %d bpm", td->min_hrt);
+ }
+ if (td->max_hrt) {
+ TD("<b>Max Heart Rate</b> %d bpm", td->max_hrt);
+ }
+ if (td->avg_cad) {
+ TD("<b>Avg Cadence</b> %.1f rpm", td->avg_cad);
+ }
+ if (td->max_cad) {
+ TD("<b>Max Cadence</b> %d rpm", td->max_cad);
+ }
+
kml_write_xml(-1, "</table>]]>\n");
kml_write_xml(-1, "</description>\n");
static
void kml_output_header(const route_head *header, computed_trkdata*td)
{
- kml_write_xml(1, "<Folder>\n");
+ kml_write_xml(1, "<Folder>\n");
kml_write_xmle("name", header->rte_name);
kml_output_trkdescription(header, td);
- if (export_points && header->rte_waypt_ct > 0) {
- // Put the points in a subfolder
- kml_write_xml(1, "<Folder>\n");
- kml_write_xml(0, "<name>Points</name>\n");
- }
+ if (export_points && header->rte_waypt_ct > 0) {
+ // Put the points in a subfolder
+ kml_write_xml(1, "<Folder>\n");
+ kml_write_xml(0, "<name>Points</name>\n");
+ }
// Create an array for holding waypoint coordinates so that we
// can produce a LineString at the end.
kml_write_xml(1, "<Style id=\"lineStyle\">\n");
kml_write_xml(1, "<LineStyle>\n");
kml_write_xml(0, "<color>%s</color>\n", opt_line_color);
- kml_write_xml(0, "<width>%s</width>\n", opt_line_width);
+ kml_write_xml(0, "<width>%s</width>\n", opt_line_width);
kml_write_xml(-1, "</LineStyle>\n");
kml_write_xml(-1, "</Style>\n");
if (!realtime_positioning) {
kml_write_xml(-1, "</Folder>\n");
}
-
+
// Output routes
if (!realtime_positioning) {
kml_write_xml(1, "<Folder>\n");
route_head *rte_head;
rte_head = (route_head *) xcalloc(sizeof (*rte_head), 1);
QUEUE_INIT(&rte_head->Q);
- QUEUE_INIT(&rte_head->waypoint_list);
+ QUEUE_INIT(&rte_head->waypoint_list);
return rte_head;
}
static void
any_route_add_head( route_head *rte, queue *head ) {
- ENQUEUE_TAIL( head, &rte->Q );
+ ENQUEUE_TAIL( head, &rte->Q );
}
static void
{
queue *elem, *tmp;
queue *q;
- QUEUE_FOR_EACH(head, elem, tmp ) {
+ QUEUE_FOR_EACH(head, elem, tmp ) {
q = dequeue(elem);
any_route_free((route_head *)q);
}
dst_wpt_count = &junk;
}
- if ( !*dst ) {
+ if ( !*dst ) {
*dst = xcalloc( 1, sizeof( queue ));
QUEUE_INIT( *dst );
*dst_count = 0;
waypoint *prev = &first;
queue *elem, *tmp;
int tkpt = 0;
+ int pts_hrt = 0;
+ double tot_hrt = 0.0;
+ int pts_cad = 0;
+ double tot_cad = 0.0;
char tkptname[100];
computed_trkdata *tdata = xcalloc(1, sizeof (computed_trkdata));
first.latitude = 0;
first.longitude = 0;
first.creation_time = 0;
+ tdata->min_hrt = 9999;
tdata->min_alt = 999999999;
tdata->max_alt = -999999999;
tdata->max_alt = this->altitude;
}
+ if (this->heartrate > 0) {
+ pts_hrt++;
+ tot_hrt += (float) this->heartrate;
+ }
+
+ if ((this->heartrate > 0) && (this->heartrate < tdata->min_hrt)) {
+ tdata->min_hrt = (int) this->heartrate;
+ }
+
+ if ((this->heartrate > 0) && (this->heartrate > tdata->max_hrt)) {
+ tdata->max_hrt = (int) this->heartrate;
+ }
+
+ if (this->cadence > 0) {
+ pts_cad++;
+ tot_cad += (float) this->cadence;
+ }
+
+ if ((this->cadence > 0) && (this->cadence > tdata->max_cad)) {
+ tdata->max_cad = (int) this->cadence;
+ }
+
if (this->creation_time && (this->creation_time < tdata->start)) {
tdata->start = this->creation_time;
}
}
tkpt++;
}
+
+ if (pts_hrt > 0) {
+ tdata->avg_hrt = tot_hrt / (float) pts_hrt;
+ }
+
+ if (pts_cad > 0) {
+ tdata->avg_cad = tot_cad / (float) pts_cad;
+ }
+
if (!trkdatap) {
xfree(tdata);
}